<html>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="__STATIC__/plugs/layui/css/layui.css" media="all"/>
<link rel="stylesheet" href="__STATIC__/css/blog/login_open.css" media="all">
<body>
<div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">
    <div class="layadmin-user-login-main">
        <div class="layadmin-user-login-box layadmin-user-login-header">
            <h2>会员登录</h2>
        </div>
        <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
                <input type="text" id="username" name="username" id="LAY-user-login-username" lay-verify="required" placeholder="用户名" class="layui-input">
            </div>
            <div class="layui-form-item">
                <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
                <input type="password" id="password" name="password" id="LAY-user-login-password" lay-verify="required" placeholder="密码" class="layui-input">
            </div>

            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-xs7">
                        <label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="LAY-user-login-vercode"></label>
                        <input type="text" id="vercode" name="vercode" id="LAY-user-login-vercode" placeholder="图形验证码" class="layui-input">
                    </div>
                    <div class="layui-col-xs5">
                        <div style="margin-left: 10px;">
                            <img src="{:captcha_src()}" onclick="this.src='{:captcha_src()}?seed='+Math.random()" class="layadmin-user-login-codeimg" lay-submit lay-filter="LAY-user-get-vercode">
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-form-item" style="margin-bottom: 20px;">
                <input type="checkbox" name="remember" lay-skin="primary" title="记住密码">
                <!--<a href="#" class="layadmin-user-jump-change layadmin-link" style="margin-top: 7px;">忘记密码？</a>-->
            </div>
            <div class="layui-form-item">
                <button id="loginButton" class="layui-btn layui-btn-fluid">登 入</button>
            </div>
            <div class="layui-trans layui-form-item layadmin-user-login-other">
                <label>社交账号登入</label>
                <a id="qq_login"><i class="layui-icon layui-icon-login-qq"></i></a>
                <!--<a href="javascript:;"><i class="layui-icon layui-icon-login-wechat"></i></a>-->
                <!--<a href="javascript:;"><i class="layui-icon layui-icon-login-weibo"></i></a>-->
                <a id="register" class="layadmin-user-jump-change layadmin-link">注册帐号</a>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="__STATIC__/plugs/jquery/jquery-2.2.4.min.js"></script>
<script type="text/javascript" src="__STATIC__/plugs/blog/layer/3.0/layer.js"></script>
<script type="text/javascript" src="__STATIC__/plugs/layui/layui.js"></script>
<!--<script type="text/javascript" src="__STATIC__/blog.js"></script>-->
<script>

    /**
     * 会员登录
     */
    $("#loginButton").click(function () {
        var data = {
            username: $("#username").val(),
            password: $("#password").val(),
            vercode: $("#vercode").val()
        }
        var loading = layer.load({time: 0, scrollbar: false, shade: this.shade});
        $.post("{:url('@blog/login')}", data, function (result) {
                layer.close(loading);
                if (result.code == 0) {
                    layer.msg(result.msg, {icon: 1, time: 1000}, function () {
                        index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                        window.parent.location.reload();
                    });
                }
                else {
                    layer.msg(result.msg, {icon: 2, time: 5000});
                }
            }
        ).error(function () {
            layer.msg('系统错误，请稍后再试', {icon: 2, time: 5000});
        });
        return false;
    });

    /**
     * qq快捷登录
     */
    $("#qq_login").click(function () {
        index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
        window.parent.location.href = "{:url('@blog/oauth/index')}";
    });

    /**
     * 注册页面
     */
    $("#register").click(function () {
        index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
        window.parent.location.href = "{:url('@blog/login/register')}";
    });
</script>
</body>
</html>
